- expanded = expanded_by_default?

%section.settings.no-animate#cleanup{ class: ('expanded' if expanded) }
  .settings-header
    %h4.settings-title.js-settings-toggle.js-settings-toggle-trigger-only= _('Repository cleanup')
    = render Pajamas::ButtonComponent.new(button_options: { class: 'js-settings-toggle' }) do
      = expanded ? _('Collapse') : _('Expand')
    %p
      - link_url = 'https://github.com/newren/git-filter-repo'
      - link_start = '<a href="%{url}" target="_blank" rel="noopener noreferrer">'.html_safe % { url: link_url }
      - link_end = '</a>'.html_safe
      = _("Clean up after running %{link_start}git filter-repo%{link_end} on the repository.").html_safe % { link_start: link_start, link_end: link_end }
      = link_to sprite_icon('question-o'),
          help_page_path('user/project/repository/reducing_the_repo_size_using_git.md'),
          target: '_blank', rel: 'noopener noreferrer'

  .settings-content
    - url = cleanup_namespace_project_settings_repository_path(@project.namespace, @project)
    = gitlab_ui_form_for @project, url: url, method: :post, authenticity_token: true, html: { class: 'js-requires-input' } do |f|
      %fieldset.gl-mt-0.gl-mb-3
        .gl-mb-3
          %h5.gl-mt-0
            = _("Upload object map")
          = render Pajamas::ButtonComponent.new(button_options: { class: 'js-choose-file' }) do
            = _("Choose a file")
          %span.gl-ml-3.js-filename
            = _("No file selected")
          = f.file_field :bfg_object_map, class: "hidden js-object-map-input", required: true
        .form-text.text-muted
          = _("The maximum file size is %{size}.") % { size: number_to_human_size(Gitlab::CurrentSettings.max_attachment_size.megabytes) }

      = f.submit _('Start cleanup'), pajamas_button: true
